package com.woniu.service.command;

import com.woniu.utils.ApplicationContextHolder;
import lombok.Data;

@Data
public class UpdateBuyStatusCommand {
   private Long orderId;
   private String buyCost;
   private Double buyShare;
   private UpdateBuyStatusCommandHandler handler;

   public UpdateBuyStatusCommand(){
       this.handler=ApplicationContextHolder.getApplicationContext().getBean(UpdateBuyStatusCommandHandler.class);
   }

    public UpdateBuyStatusCommand(Long orderId, String buyCost, Double buyShare) {
        this();
        this.orderId = orderId;
        this.buyCost = buyCost;
        this.buyShare = buyShare;
    }

    public void execute(){
      handler.updateBuyStatus(this);
    }
}
